<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/HomeTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                >
    <ui:define name="body">
        <div class="main-container" >
        <p:tabMenu id="tab1" model="#{dynamicMenu.getSimpleMenuModel(2)}" style="width: 90%"  />
        <h:form id="form" style="width: 1200px" > 
                <p:panel style="border-bottom: none; width: 1200px" >
                <h:panelGrid columns="4"  style="border-bottom-width: 0px; border-spacing: 0px; ">
                    <h:outputText value="Start Date"/>  
                    <p:calendar value="#{traceOrderBean.start}" id="start" showOn="button" pattern="dd/MM/yyyy" /> 
                    <h:outputText value="End Date"/>  
                    <p:calendar value="#{traceOrderBean.finish}" id="end" showOn="button" pattern="dd/MM/yyyy" /> 
                </h:panelGrid>
                <h:panelGrid columns="6"  style="border-bottom-width: 0px; border-spacing: 0px; ">

                    <h:outputText value="Order No :" />  
                    <p:inputText id="orderNo" value="#{traceOrderBean.order}" style="width:150px; height: 25px" >

                    </p:inputText>

                    <h:outputText value="Shipment: " />  
                    <p:selectOneMenu value="#{traceOrderBean.ship}">  
                        <f:selectItem itemLabel="Select One" itemValue="-1" />  
                        <f:selectItem itemLabel="All" itemValue="0" />  
                        <f:selectItem itemLabel="Non Delivery" itemValue="1" />  
                        <f:selectItem itemLabel="Delivery" itemValue="2" />  
                        <f:selectItem itemLabel="In process" itemValue="3" /> 
                    </p:selectOneMenu>  

                    <h:outputText value="Payment :" />  
                    <p:selectBooleanCheckbox id="payment" value="#{traceOrderBean.pay}">   
                    </p:selectBooleanCheckbox>  
                   
                </h:panelGrid>
                <h:panelGrid columns="4" cellpadding="5" style="border-bottom-width: 30px">  
                    <p:commandButton  value="Filter" icon="filter"  action="#{traceOrderBean.filterCriteria()}" update="dataTable" ajax="false"></p:commandButton> 
                    <p:commandButton  value="PDF" icon="pdf"> </p:commandButton> 
                    <p:commandButton  value="Excel" icon="excel" action="#{authentication.logout()}"> </p:commandButton>
                    <p:commandButton value=" Detalles "   style="color: #0072C6;" action="#{traceOrderBean.adminOrderById()}" > </p:commandButton>
                </h:panelGrid>
                </p:panel>
            <p:dataTable id="dataTable" var="order" value="#{traceOrderBean.adminClosedOrders}" widgetVar="inventoryTable" paginator="true"
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
                             {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" paginatorPosition="bottom" editable="true" editMode="cell"
                             rows="7" rowsPerPageTemplate="7,14,21" selectionMode="single" rowKey="#{order.idOrder}" selection="#{traceOrderBean.orderById}"
                             >   
                    <p:column >  
                        <f:facet name="header">  
                            Order No
                        </f:facet>  

                        <h:outputText value="#{order.idOrder}" />  

                    </p:column> 
                    <p:column headerText="Order Date">  

                        <h:outputText value="#{order.dateOrder}"  >
                            <f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="Total Quantity">  
                        <h:outputText value="#{order.totalItems}" />  
                    </p:column> 
                    <p:column headerText="Total Amount">  
                        <h:outputText value="#{order.total}" />  
                    </p:column> 

                    <p:column headerText="Shipment">  
                        <h:outputText value="#{order.idShipment.description}" />  
                    </p:column>  

                    <p:column headerText="Payment" >  
                        <p:selectBooleanCheckbox id="payment" value="#{order.payment}">   
                    </p:selectBooleanCheckbox>  
                         
                    </p:column>  

                    <f:facet name="footer">  
                        In total there are #{traceOrderBean.orders.size()} Items.  
                    </f:facet>  

                </p:dataTable> 


            </h:form>
  </div>
    </ui:define>
</ui:composition>



